package com.xxx.demo.client.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.butid.data.base.BaseService;
import com.xxx.demo.client.entity.Demo;
import com.xxx.demo.client.mapper.DemoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Service示例，DemoService
 * Created By wangjingjing@qqc.om On 2020-8-21
 **/
@Service
@Slf4j
public class DemoService extends BaseService<DemoMapper, Demo> {

    /**
     * 查询最后10条数据
     * @return
     */
    public List<Map<String, Object>> queryTranslog() {
        LambdaQueryWrapper<Demo> query = new LambdaQueryWrapper<>();
        query.orderByDesc(Demo::getTranlogId);

        return this.pageMaps(new Page<>(1, 10), query).getRecords();
    }

}
